home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / esp10wr / formesp.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-01-24  |  6.2 KB  |  226 lines

  1. VERSION 5.00
  2. Object = "{8416B1C5-B384-11D2-BC2F-A45A05C10000}#1.0#0"; "EASYSP.OCX"
  3. Begin VB.Form frmExample 
  4.    Caption         =   "Example"
  5.    ClientHeight    =   5430
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   9855
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   5430
  11.    ScaleWidth      =   9855
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin EasyServicePack.EasySP EasySP1 
  14.       Left            =   60
  15.       Top             =   330
  16.       _ExtentX        =   794
  17.       _ExtentY        =   794
  18.       LogFileName     =   "logerr.txt"
  19.       ActionFileName  =   "easySP.txt"
  20.       LogFilePath     =   "C:\WINDOWS\"
  21.       ActionFilePath  =   "C:\WINDOWS\"
  22.       Delimiter       =   ";"
  23.    End
  24.    Begin VB.CommandButton Command1 
  25.       Caption         =   "&Load Action File"
  26.       Height          =   525
  27.       Left            =   7050
  28.       TabIndex        =   8
  29.       Top             =   720
  30.       Width           =   2205
  31.    End
  32.    Begin VB.CommandButton cmdSaveAction 
  33.       Caption         =   "Save &Action File"
  34.       Height          =   525
  35.       Left            =   4740
  36.       TabIndex        =   7
  37.       Top             =   720
  38.       Width           =   2205
  39.    End
  40.    Begin VB.CommandButton cdmGetAction 
  41.       Caption         =   "&Show Action File"
  42.       Height          =   525
  43.       Left            =   2430
  44.       TabIndex        =   6
  45.       Top             =   720
  46.       Width           =   2205
  47.    End
  48.    Begin VB.CommandButton cmdGetFile 
  49.       Caption         =   "Show &Log File"
  50.       Height          =   525
  51.       Left            =   120
  52.       TabIndex        =   5
  53.       Top             =   720
  54.       Width           =   2205
  55.    End
  56.    Begin VB.TextBox txtContents 
  57.       BeginProperty Font 
  58.          Name            =   "Courier New"
  59.          Size            =   8.25
  60.          Charset         =   0
  61.          Weight          =   400
  62.          Underline       =   0   'False
  63.          Italic          =   0   'False
  64.          Strikethrough   =   0   'False
  65.       EndProperty
  66.       Height          =   4065
  67.       Left            =   0
  68.       MultiLine       =   -1  'True
  69.       ScrollBars      =   2  'Vertical
  70.       TabIndex        =   4
  71.       Top             =   1320
  72.       Width           =   9765
  73.    End
  74.    Begin VB.CommandButton cmdTest4 
  75.       Caption         =   "Test &4  (warning, halt!)"
  76.       Height          =   555
  77.       Left            =   7050
  78.       TabIndex        =   3
  79.       Top             =   90
  80.       Width           =   2205
  81.    End
  82.    Begin VB.CommandButton cmdTest3 
  83.       Caption         =   "Test &3"
  84.       Height          =   555
  85.       Left            =   4740
  86.       TabIndex        =   2
  87.       Top             =   90
  88.       Width           =   2205
  89.    End
  90.    Begin VB.CommandButton cmdTest2 
  91.       Caption         =   "Test &2"
  92.       Height          =   555
  93.       Left            =   2430
  94.       TabIndex        =   1
  95.       Top             =   90
  96.       Width           =   2205
  97.    End
  98.    Begin VB.CommandButton cmdTest1 
  99.       Caption         =   "Test &1"
  100.       Height          =   555
  101.       Left            =   120
  102.       TabIndex        =   0
  103.       Top             =   90
  104.       Width           =   2205
  105.    End
  106. Attribute VB_Name = "frmExample"
  107. Attribute VB_GlobalNameSpace = False
  108. Attribute VB_Creatable = False
  109. Attribute VB_PredeclaredId = True
  110. Attribute VB_Exposed = False
  111. Option Explicit
  112. Dim x As Integer
  113. Dim hhh As HHCtrl
  114. Private Sub Command1_Click()
  115. EasySP1.LoadActionFile
  116. End Sub
  117. Private Sub Form_Load()
  118. EasySP1.ActionFilePath = App.Path & "\"
  119. EasySP1.LogFilePath = App.Path & "\"
  120. EasySP1.LoadActionFile
  121. End Sub
  122. Private Sub cdmGetAction_Click()
  123. txtContents.Text = GetText(App.Path & "\" & "easysp.txt")
  124. cmdSaveAction.Enabled = True
  125. End Sub
  126. Private Sub cmdGetFile_Click()
  127. txtContents.Text = GetText(App.Path & "\" & "logerr.txt")
  128. cmdSaveAction.Enabled = False
  129. End Sub
  130. Private Sub cmdSaveAction_Click()
  131. SaveText App.Path & "\" & "easysp.txt", txtContents.Text
  132. End Sub
  133. Private Sub cmdTest1_Click()
  134. On Error GoTo ErrLabel
  135. Dim times As Integer
  136. Dir "a:" '--------> error simulation
  137. MsgBox "don't end"
  138. Exit Sub
  139. ErrLabel:
  140. EasySP1.ErrorScope = Screen.ActiveForm.Name & "-" & _
  141. Screen.ActiveControl.Name
  142. If EasySP1.UseResume(Err, 52) Then
  143.   times = times + 1  '--------> allow exit loop
  144.   Resume
  145. ElseIf EasySP1.UseResumeNext(Err, 55) Then
  146.   Resume Next
  147. ElseIf EasySP1.UseExit(Err, 11) Then
  148.   Exit Sub
  149. Else: EasySP1.UseRaiseError Err
  150. End If
  151. End Sub
  152. Private Sub cmdTest2_Click()
  153. On Error GoTo ErrLabel
  154. Err.Raise 55    '--------> error simulation
  155. MsgBox "don't end"
  156. Exit Sub
  157. ErrLabel:
  158. EasySP1.ErrorScope = Screen.ActiveForm.Name & _
  159. Screen.ActiveControl.Name
  160. If EasySP1.UseResume(Err, 52) Then
  161.   Resume
  162. ElseIf EasySP1.UseResumeNext(Err, 55) Then
  163.   Resume Next
  164. ElseIf EasySP1.UseExit(Err, 11) Then
  165.   Exit Sub
  166. Else: EasySP1.UseRaiseError Err
  167. End If
  168. End Sub
  169. Private Sub cmdTest3_Click()
  170. On Error GoTo ErrLabel
  171. x = 1 / 0   '--------> error 11
  172. MsgBox "don't end"
  173. Exit Sub
  174. ErrLabel:
  175. EasySP1.ErrorScope = Screen.ActiveForm.Name & _
  176. Screen.ActiveControl.Name
  177. If EasySP1.UseResume(Err, 52) Then
  178.   Resume
  179. ElseIf EasySP1.UseResumeNext(Err, 55) Then
  180.   Resume Next
  181. ElseIf EasySP1.UseExit(Err, 11) Then
  182.   Exit Sub
  183. Else: EasySP1.UseRaiseError Err
  184. End If
  185. End Sub
  186. Private Sub cmdTest4_Click()
  187. On Error GoTo ErrLabel
  188. Err.Raise 76    '--------> error simulation
  189. MsgBox "don't end"
  190. Exit Sub
  191. ErrLabel:
  192. EasySP1.ErrorScope = Screen.ActiveForm.Name & _
  193. Screen.ActiveControl.Name
  194. If EasySP1.UseResume(Err, 52) Then
  195.   Resume
  196. ElseIf EasySP1.UseResumeNext(Err, 55) Then
  197.   Resume Next
  198. ElseIf EasySP1.UseExit(Err, 11) Then
  199.   Exit Sub
  200. Else: EasySP1.UseRaiseError Err
  201. End If
  202. End Sub
  203. Function GetText(FileName As String) As String
  204. Dim n As Integer
  205. Dim res As String
  206. Dim lin As String
  207. n = FreeFile
  208. 'On Error GoTo ExitS
  209. Open FileName For Input As #n
  210. Do Until EOF(n)
  211.     Line Input #n, lin
  212.     res = res & lin & vbCrLf
  213. GetText = res
  214. Close #n
  215. Exit Function
  216. ExitS:
  217. txtContents.Text = ""
  218. End Function
  219. Sub SaveText(FileName As String, TxtInfo As String)
  220. Dim n As Integer
  221. n = 18
  222. Open FileName For Output As #n
  223.     Print #n, TxtInfo
  224. Close #n
  225. End Sub
  226.